package com.db.williamchart.data.configuration;

import com.db.williamchart.data.AxisType;
import com.db.williamchart.data.Frame;
import com.db.williamchart.data.Paddings;
import com.db.williamchart.data.Scale;

public class ChartConfiguration {

    private int width;
    private int height;
    private Paddings paddings;
    private AxisType axis;
    private float labelsSize;
    private Scale scale;
    private String labelsFormatter;

    public ChartConfiguration(int width,
                              int height,
                              Paddings paddings,
                              AxisType axis,
                              float labelsSize,
                              Scale scale,
                              String labelsFormatter) {

        this.width = width;
        this.height = height;
        this.paddings = paddings;
        this.axis = axis;
        this.labelsSize = labelsSize;
        this.scale = scale;
        this.labelsFormatter = labelsFormatter;
    }

    public Frame toOuterFrame() {
        return new Frame(
                paddings.getLeft(),
                paddings.getTop(),
                width - paddings.getRight(),
                height - paddings.getBottom()
        );
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public Paddings getPaddings() {
        return paddings;
    }

    public void setPaddings(Paddings paddings) {
        this.paddings = paddings;
    }

    public AxisType getAxis() {
        return axis;
    }

    public void setAxis(AxisType axis) {
        this.axis = axis;
    }

    public float getLabelsSize() {
        return labelsSize;
    }

    public void setLabelsSize(float labelsSize) {
        this.labelsSize = labelsSize;
    }

    public Scale getScale() {
        return scale;
    }

    public void setScale(Scale scale) {
        this.scale = scale;
    }

    public String getLabelsFormatter() {
        return labelsFormatter;
    }

    public void setLabelsFormatter(float labelsFormatter) {
        this.labelsFormatter = String.valueOf(labelsFormatter);
    }
}
